package com.example.javaairportflightanalysis.dao;


import com.example.javaairportflightanalysis.domin.userpojo.User;

import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * (User)表数据库访问层
 *

 */

public interface UserMapper {
    @Select("select * from t_user where username=#{username}")
    User selectByUsername(String username);

    @Select("select * from t_user where id=#{id}")
    User selectById(@Param("id") Integer parseInt);

    @Select("select * from t_user ")
    List<User> findAllUser ();

    @Insert("insert into t_user values(#{username},#{password},#{phone},#{sex},#{img},#{remark},#{createTime},#{updateTime})")
    void addUser(User user);

    @Delete("delete from t_user where id=#{id}")
    void deleteUser(Integer id);

    @Update("update t_user set username=#{username},password=#{password}," +
            "phone=#{phone},sex=#{sex},img=#{img},remark=#{remark},update_Time=#{updateTime} where id=#{id}")
    void updateUser(User user);

    @Insert("insert into t_user (username,password,phone,sex,img,remark,create_time,update_time) values (#{username},#{password},#{phone},#{sex},#{img},#{remark},#{createTime},#{updateTime})")
    Integer insertSelective(@RequestParam User user);

    @Update("update t_user set img=#{path}" +
            " where id=#{id}")
    void updateUserImg(String path,@Param("id") Integer id);
}

